package com.bluexmicro.ota2

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import com.bluexmicro.ota2.ui.screen.dfu.DfuScreen
import com.bluexmicro.ota2.ui.screen.index.IndexScreen
import com.bluexmicro.ota2.ui.screen.asset.AssetScreen
import com.bluexmicro.ota2.ui.screen.asset.AssetType
import com.bluexmicro.ota2.ui.screen.config.ConfigScreen
import com.bluexmicro.ota2.ui.screen.dfu.BatchDfuScreen
import com.bluexmicro.ota2.ui.screen.facecustom.CustomFaceScreen
import com.bluexmicro.ota2.ui.screen.yika.YiKaBatchDfuScreen
import com.bluexmicro.ota2.ui.screen.yika.YiKaCheckScreen

sealed class MainRoute(val path: String) {

    object Index : MainRoute("Index")
    object DFU : MainRoute("DFU")
    object Batch : MainRoute("Batch")
    object Face : MainRoute("Face")
    object Dict : MainRoute("Dict")
    object FaceCustom : MainRoute("FaceCustom")

    object YiKaBatch : MainRoute("YiKaBatch")
    object YiKaCheck : MainRoute("YiKaCheck")

    object YanConfig : MainRoute("YanConfig")
}

@Composable
fun MainNavHost(
    mainNavHostController: NavHostController = rememberNavController()
) {

    NavHost(
        navController = mainNavHostController,
        startDestination = MainRoute.Index.path,
        modifier = Modifier
            .fillMaxSize()
            .navigationBarsPadding()
    ) {

        composable(MainRoute.Index.path) {
            IndexScreen(mainNavHostController)
        }
        composable(MainRoute.DFU.path) {
            DfuScreen(mainNavHostController)
        }
        composable(MainRoute.Batch.path) {
            BatchDfuScreen(mainNavHostController)
        }
        composable(MainRoute.Face.path) {
            AssetScreen(navHostController = mainNavHostController, type = AssetType.Face)
        }
        composable(MainRoute.Dict.path) {
            AssetScreen(navHostController = mainNavHostController, type = AssetType.Dict)
        }
        composable(MainRoute.FaceCustom.path) {
            CustomFaceScreen(navHostController = mainNavHostController)
        }
        composable(MainRoute.YiKaBatch.path) {
            YiKaBatchDfuScreen(navHostController = mainNavHostController)
        }
        composable(MainRoute.YiKaCheck.path) {
            YiKaCheckScreen(navHostController = mainNavHostController)
        }

        composable(MainRoute.YanConfig.path) {
            ConfigScreen(mainNavHostController)
        }
    }
}
